package main

import (
	"fmt"
)

func main() {
	resume := func() chan int {
		yield := make(chan int)
		count := 0
		go func() {
			for {
				yield <- count
				count++
			}
		}()
		return yield
	}()
	for res := range resume {
		fmt.Println("res is ", res)
	}
}
